# config.py  ———— 替换全文
import os
from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent.parent

LOG_DIR = BASE_DIR / "logs"
CONFIG_DIR = BASE_DIR / "config"
DATA_DIR = BASE_DIR / "data"

for d in (LOG_DIR, CONFIG_DIR, DATA_DIR):
    d.mkdir(parents=True, exist_ok=True)

# 统一的配置/状态文件
SYSTEM_STATE_FILE = CONFIG_DIR / "system_state.json"
REAGENT_FILE = CONFIG_DIR / "reagents.json"
INJECT_FILE = CONFIG_DIR / "inject_steps.json"
LOCK_FILE = CONFIG_DIR / "reagent.lock"   # ★ 改为明确的文件

# 串口/安全
SERIAL_PORT = "/dev/ttyUSB0" if os.name == 'posix' else "COM3"
BAUDRATE = 57600
SECRET_KEY = os.environ.get('SECRET_KEY') or 'your-secret-key-here'

STATUS_FILE = DATA_DIR / "config_status.json"
